From 819db6470099f9833d5a5027020c369d4b40e323 Mon Sep 17 00:00:00 2001
From: Santo Cariotti <santo@dcariotti.me>
Date: Sat, 31 Aug 2024 12:37:42 +0200
Subject: Add boxs on alert page

---
 app/(tabs)/alerts/[id].tsx | 65 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 app/(tabs)/alerts/[id].tsx

(limited to 'app/(tabs)/alerts/[id].tsx')

diff --git a/app/(tabs)/alerts/[id].tsx b/app/(tabs)/alerts/[id].tsx
new file mode 100644
index 0000000..cc425db
--- /dev/null
+++ b/app/(tabs)/alerts/[id].tsx
@@ -0,0 +1,65 @@
+import {
+  Alert,
+  Platform,
+  StyleSheet,
+} from 'react-native';
+import ParallaxScrollView from '@/components/ParallaxScrollView';
+import { ThemedText } from '@/components/ThemedText';
+import { ThemedView } from '@/components/ThemedView';
+import React, { useState, useCallback } from 'react';
+import AsyncStorage from '@react-native-async-storage/async-storage';
+import { useFocusEffect } from '@react-navigation/native';
+import { router, useLocalSearchParams } from 'expo-router';
+
+export default function AlertIdScreen() {
+  const [token, setToken] = useState('');
+  const [userId, setUserId] = useState('');
+
+  const checkAuth = async () => {
+    const storedToken =
+      Platform.OS === 'web'
+        ? localStorage.getItem('token')
+        : await AsyncStorage.getItem('token');
+    const storedUserId =
+      Platform.OS === 'web'
+        ? localStorage.getItem('userId')
+        : await AsyncStorage.getItem('userId');
+
+    setToken(storedToken || '');
+    setUserId(storedUserId || '');
+
+    if (!storedToken || !storedUserId) {
+      Alert.alert(
+        'Login required',
+        'You must log in to the system if you want to see alerts list',
+        [
+          {
+            text: 'Ok',
+            onPress: () => router.push('/'),
+          },
+        ]
+      );
+    }
+  };
+
+  useFocusEffect(
+    useCallback(() => {
+      checkAuth();
+    }, [])
+  );
+
+
+  const { id } = useLocalSearchParams();
+
+
+  return (
+    <ParallaxScrollView>
+      <ThemedView>
+        <ThemedText>{ id }</ThemedText>
+      </ThemedView>
+    </ParallaxScrollView>
+  );
+}
+
+const styles = StyleSheet.create({
+});
-- 
cgit v1.2.3-71-g8e6c

